<?php

namespace app\shop\controller;

// 框架基础控制类
use think\Controller;
use think\Request;

class Cart extends Controller
{
    //构造函数
    public function __construct()
    {
        //手动把父类的方法获取过来
        parent::__construct();

        // check_cors_request();

        // 全局用户模型
        $this->BusinessModel = model('Business.Business');
        $this->RecordModel = model('Business.Record');
        $this->ProductModel = model('Product.Product');
        $this->CartModel = model('Product.Cart');
    }

    // 添加购物车
    public function add()
    {
        $proid = $this->request->param('proid', 0, 'trim');

        $busid = $this->request->param('busid', 0, 'trim');

        $info =  $this->ProductModel->find($proid);

        if (!$info) {
            $this->error('当前商品不存在');
        }

        $userinfo =  $this->BusinessModel->find($busid);

        if (!$userinfo) {
            $this->error('当前用户不存在');
        }

        $data
    }
}
